//
//  HomeViewController.m
//  CookDemo
//
//  Created by lanou3g on 15/8/30.
//  Copyright (c) 2015年 DTR. All rights reserved.
//

#import "HomeViewController.h"
#import "HomeTableViewCell.h"
#import "KitchenManager.h"
#import "KitchenInfo.h"
#import "PopularDetailsInfo.h"
#import "Kitchen.h"
#import "ListViewController.h"
@interface HomeViewController ()

@property (weak, nonatomic) IBOutlet UITableView *Home;
@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [[KitchenManager defaultManager]GetKitchenInfoComplete:^{
        [_Home reloadData];
      
    }];
    
    
     
    self.edgesForExtendedLayout=0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [KitchenManager defaultManager].RecommendList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    HomeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"homeCell" forIndexPath:indexPath];
    RecommendKitchenInfo *recommendKitchenInfo = [KitchenManager defaultManager].RecommendList[indexPath.row];

    [cell setCellWithKitchenInfo:recommendKitchenInfo];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//    ListViewController *listVC = [[ListViewController alloc]init];
//    [self showViewController:listVC sender:nil];
//    [self shouldPerformSegueWithIdentifier:@"homeCell" sender:nil];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}




#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    ListViewController *ListVC = segue.destinationViewController;
    ListVC = sender;
    
}


@end
